# Maintainer: Jan Alexander Steffens (heftig) <heftig@archlinux.org>
# Contributor: Jan de Groot <jgc@archlinux.org>

pkgbase=libgweather-4
pkgname=(
  libgweather-4
  libgweather-4-docs
)
pkgver=4.4.0
pkgrel=1
pkgdesc="Location and timezone database and weather-lookup library"
url="https://wiki.gnome.org/Projects/LibGWeather"
arch=(loong64 x86_64)
license=(LGPL)
depends=(
  dconf
  geocode-glib-2
  libsoup3
  libxml2
)
makedepends=(
  gi-docgen
  git
  gobject-introspection
  meson
  python-gobject
  vala
)
checkdepends=(python-pylint)
_commit=04da97b8f86b1d10540f7d907841bfb5fde6bd2d  # tags/4.4.0^0
source=(
  "git+https://gitlab.gnome.org/GNOME/libgweather.git#commit=$_commit"
  disable-metar-test.diff
)
b2sums=('SKIP'
        '3d920f17e3f82bd33791b1e9662242f90a13e3cb3832fea5b900046b0ad90f97c5cf8174a6e5905b134585f280706ab67d3b65c108ed99c8285e3f05293b2b73')

pkgver() {
  cd libgweather
  git describe --tags | sed 's/[^-]*-g/r&/;s/-/+/g'
}

prepare() {
  cd libgweather

  # Disable metar test, depends on unstable online service
  git apply -3 ../disable-metar-test.diff
}

build() {
  local meson_options=(
    -D gtk_doc=true
  )

  arch-meson libgweather build "${meson_options[@]}"
  meson compile -C build
}

check() {
  meson test -C build --print-errorlogs
}

package_libgweather-4() {
  provides=(libgweather-4.so)

  meson install -C build --destdir "$pkgdir"

  mkdir -p doc/usr/share
  mv {"$pkgdir",doc}/usr/share/doc
}

package_libgweather-4-docs() {
  pkgdesc+=" (documentation)"
  depends=()

  mv doc/* "$pkgdir"
}

# vim:set sw=2 sts=-1 et:
